/** *******************************************************************
 * FlexDatabaseManager
 * Copyright (c) 2008 Jonnie Spratley. All Rights Reserved.
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 * @internal
 ******************************************************************* */
package com.jonniespratley.flexdatabasemanager.control
{
	import com.adobe.cairngorm.control.FrontController;
	import com.jonniespratley.flexdatabasemanager.commands.*;
	import com.jonniespratley.flexdatabasemanager.commands.accounts.*;
	import com.jonniespratley.flexdatabasemanager.commands.backups.*;
	import com.jonniespratley.flexdatabasemanager.commands.databases.*;
	import com.jonniespratley.flexdatabasemanager.commands.help.*;
	import com.jonniespratley.flexdatabasemanager.commands.query.*;
	import com.jonniespratley.flexdatabasemanager.commands.system.*;
	import com.jonniespratley.flexdatabasemanager.commands.tables.*;
	import com.jonniespratley.flexdatabasemanager.events.accounts.*;
	import com.jonniespratley.flexdatabasemanager.events.backups.*;
	import com.jonniespratley.flexdatabasemanager.events.databases.*;
	import com.jonniespratley.flexdatabasemanager.events.help.*;
	import com.jonniespratley.flexdatabasemanager.events.query.*;
	import com.jonniespratley.flexdatabasemanager.events.system.*;
	import com.jonniespratley.flexdatabasemanager.events.tables.*;

	public final class FlexDatabaseManagerController extends FrontController
	{
		public function FlexDatabaseManagerController()
		{
			this.initialize();
		}

		private function initialize() : void
		{
			/* accounts */
			this.addCommand( LoginEvent.LOGIN_EVENT, LoginCommand );
		    this.addCommand( LogoutEvent.LOGOUT_EVENT, LogoutCommand );
		    this.addCommand( GetUserInfoEvent.GET_USER_INFO_EVENT, GetUserInfoCommand );
		    
		    /* backups */
		    this.addCommand( GetDatabaseBackupsEvent.GET_DATABASE_BACKUPS_EVENT, GetDatabaseBackupsCommand );
		    this.addCommand( CreateBackupEvent.CREATE_BACKUP_EVENT, CreateBackupCommand );
		    this.addCommand( RemoveBackupEvent.REMOVE_BACKUP_EVENT, RemoveBackupCommand );
		    
		    /* databases */
		    this.addCommand( GetDatabasesAndTablesEvent.GET_DATABASES_AND_TABLES_EVENT, GetDatabasesAndTablesCommand );
		    this.addCommand( GetDatabasesEvent.GET_DATABASES_EVENT, GetDatabasesCommand );
		    this.addCommand( SelectedDatabaseEvent.SELECTED_DATABASE_EVENT, SelectedDatabaseCommand );
		    this.addCommand( CreateDatabaseEvent.CREATE_DATABASE_EVENT, CreateDatabaseCommand );
		    
		    /* query */
		    this.addCommand( AddQueryToFavoritesEvent.ADD_QUERY_TO_FAVORITES_EVENT, AddQueryToFavoritesCommand );
		    this.addCommand( AddQueryToHistoryEvent.ADD_QUERY_TO_HISTORY_EVENT, AddQueryToHistoryCommand );
		    this.addCommand( ExecuteQueryEvent.EXECUTE_QUERY_EVENT, ExecuteQueryCommand );
		    this.addCommand( RemoveQueryFromFavoritesEvent.REMOVE_QUERY_FROM_FAVORITES_EVENT, RemoveQueryFromFavoritesCommand );
		    this.addCommand( RemoveQueryFromHistoryEvent.REMOVE_QUERY_FROM_HISTORY_EVENT, RemoveQueryFromHistoryCommand );
		    
		    /* system */
		    this.addCommand( ShowSystemProcessesEvent.SHOW_SYSTEM_PROCESSES_EVENT, ShowSystemProcessesCommand );
		    this.addCommand( ShowSystemStatusEvent.SHOW_SYSTEM_STATUS_EVENT, ShowSystemStatusCommand );
		    this.addCommand( ShowSystemUsersEvent.SHOW_SYSTEM_USERS_EVENT, ShowSystemUsersCommand );
		    this.addCommand( ShowSystemVariablesEvent.SHOW_SYSTEM_VARIABLES_EVENT, ShowSystemVariablesCommand );
		    this.addCommand( GetBytesEvent.GET_BYTES_EVENT, GetBytesCommand );
		    this.addCommand( GetCommandsEvent.GET_COMMANDS_EVENT, GetCommandsCommand );
		    this.addCommand( GetConnectionsEvent.GET_CONNECTIONS_EVENT, GetConnectionsCommand );
		    this.addCommand( GetInnoDbEvent.GET_INNODB_EVENT, GetInnoDbCommand );
		    this.addCommand( GetKeysEvent.GET_KEYS_EVENT, GetKeysCommand );
		    this.addCommand( GetOpenEvent.GET_OPEN_EVENT, GetOpenCommand );
		    this.addCommand( GetPerformanceEvent.GET_PERFORMANCE_EVENT, GetPerformanceCommand );
		    this.addCommand( GetQcacheEvent.GET_QCACHE_EVENT, GetQcacheCommand );
		    this.addCommand( GetShowCommandsEvent.GET_SHOW_COMMANDS_EVENT, GetShowCommandsCommand );
		    this.addCommand( GetSortEvent.GET_SORT_EVENT, GetSortCommand );
		    this.addCommand( GetTempEvent.GET_TEMP_EVENT, GetTempCommand );
		    this.addCommand( GetThreadsEvent.GET_THREADS_EVENT, GetThreadsCommand );
		    this.addCommand( GetQuestionsEvent.GET_QUESTIONS_EVENT, GetQuestionsCommand );
		    this.addCommand( GetUptimeEvent.GET_UPTIME_EVENT, GetUptimeCommand );
		    this.addCommand( KillProcessEvent.KILL_PROCESS_EVENT, KillProcessCommand );
		    this.addCommand( GetServerInfoEvent.GET_SERVER_INFO_EVENT, GetServerInfoCommand );
		    this.addCommand( GetHandlersEvent.GET_HANDLERS_EVENT, GetHandlersCommand );
		  
			/* tables */
		   	this.addCommand( AlterTableEvent.ALTER_TABLE_EVENT, AlterTableCommand );
		    this.addCommand( AnalyzeTableEvent.ANALYZE_TABLE_EVENT, AnalyzeTableCommand );
		    this.addCommand( CheckTableEvent.CHECK_TABLE_EVENT, CheckTableCommand );
			this.addCommand( CreateTableEvent.CREATE_TABLE_EVENT, CreateTableCommand );
		    this.addCommand( GetTableDataEvent.GET_TABLE_DATA_EVENT, GetTableDataCommand );
		    this.addCommand( GetTableIndexEvent.GET_TABLE_INDEX_EVENT, GetTableIndexCommand );
		    this.addCommand( OptimizeTableEvent.OPTIMIZE_TABLE_EVENT, OptimizeTableCommand );
		    this.addCommand( RepairTableEvent.REPAIR_TABLE_EVENT, RepairTableCommand );
		    this.addCommand( ShowTableStatusEvent.SHOW_TABLE_STATUS_EVENT, ShowTableStatusCommand );		   
		    this.addCommand( InsertRecordEvent.INSERT_RECORD_EVENT, InsertRecordCommand );
		    this.addCommand( UpdateRecordEvent.UPDATE_RECORD_EVENT, UpdateRecordCommand );
		    this.addCommand( RemoveRecordEvent.REMOVE_RECORD_EVENT, RemoveRecordCommand );
			this.addCommand( SelectedTableEvent.SELECTED_TABLE_EVENT, SelectedTableCommand );
			this.addCommand( SelectedTableStatusEvent.SELECTED_TABLE_STATUS_EVENT, SelectedTableStatusCommand );
		    
		    /* visual */
		  
		   
		    
		    
		    this.addCommand( RemoveTableEvent.REMOVE_TABLE_EVENT, RemoveTableCommand );
		    this.addCommand( RenameTableEvent.RENAME_TABLE_EVENT, RenameTableCommand );
		    this.addCommand( GetQueryHistoryEvent.GET_QUERY_HISTORY_EVENT, GetQueryHistoryCommand );
		    this.addCommand( GetQueryFavoritesEvent.GET_QUERY_FAVORITES_EVENT, GetQueryFavoritesCommand );
		    this.addCommand( SelectedFieldEvent.SELECTED_FIELD_EVENT, SelectedFieldCommand );
		    this.addCommand( ClearAllDataEvent.CLEAR_ALL_DATA_EVENT, ClearAllDataCommand );
		    this.addCommand( GetMySQLHelpEvent.GET_MYSQL_HELP_EVENT, GetMySQLHelpCommand );
		    this.addCommand( SearchMySQLHelpEvent.SEARCH_MYSQL_HELP_EVENT, SearchMySQLHelpCommand );
		    this.addCommand( GetReplicationEvent.GET_REPLICATION_EVENT, GetReplicationCommand );
		    
		    this.addCommand( GetDatabaseSpaceEvent.GET_DATABASE_SPACE_EVENT, GetDatabaseSpaceCommand );
		    this.addCommand( ExplainQueryEvent.EXPLAIN_QUERY_EVENT, ExplainQueryCommand );
		    this.addCommand( PollTrafficEvent.POLL_TRAFFIC_EVENT, PollTrafficCommand );
		    this.addCommand( PollSQLQueriesEvent.POLL_SQL_QUERIES_EVENT, PollSQLQueriesCommand );
		    this.addCommand( PollConnectionUsageEvent.POLL_CONNECTION_USAGE_EVENT, PollConnectionUsageCommand );
		    this.addCommand( AnalyeQueryEvent.ANALYE_QUERY_EVENT, AnalyeQueryCommand );
		    //todo: add commands
		}
	}
}
